<?php

require_once(_MAJIX_PATH . "majix.php");
require_once(_MAJIX_PATH . "majix_factory.php");

function majix_autoload($class_name) {
	$matches = array();
	if (preg_match('/^'._MAJIX_CLASS_PREFIX.'(.+)factory$/i', $class_name, $matches)) {
		$class_name = $matches[1];
		eval("class $class_name extends MajixFactory {}");
	} else if (preg_match('/^'._MAJIX_CLASS_PREFIX.'(.+)$/i', $class_name)) {
		eval("class $class_name extends Majix {}");
	}
}

spl_autoload_register("majix_autoload");
